﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace Chromatics.Pages.Palette
{
    public partial class OddPallete : UserControl
    {
        private int colorsCount;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ColorsCount">must be 3 or 5</param>
        public OddPallete(int ColorsCount)
        {
            InitializeComponent();

            this.AzureArc.Visibility = System.Windows.Visibility.Collapsed;
            this.BlueArc.Visibility = System.Windows.Visibility.Collapsed;
            this.RedArc.Visibility = System.Windows.Visibility.Collapsed;
            this.GreenArc.Visibility = System.Windows.Visibility.Visible;
            this.YellowArc.Visibility = System.Windows.Visibility.Visible;

            if (ColorsCount == 3 || ColorsCount == 5)
            {
                this.colorsCount = ColorsCount;
            }
            else
            {
                //throw exception
            }
        }

        private void Control_LayoutUpdated(object sender, EventArgs e)
        {
            switch (this.colorsCount)
            {
                case 3:
                    {
                        this.GreenArc.Visibility = System.Windows.Visibility.Visible;
                        this.YellowArc.Visibility = System.Windows.Visibility.Visible;
                        this.RedArc.Visibility = System.Windows.Visibility.Visible;
                        this.ArcRotation3.Begin();
                        break;
                    }
                case 5:
                    {
                        this.GreenArc.Visibility = System.Windows.Visibility.Visible;
                        this.YellowArc.Visibility = System.Windows.Visibility.Visible;
                        this.RedArc.Visibility = System.Windows.Visibility.Visible;
                        this.BlueArc.Visibility = System.Windows.Visibility.Visible;
                        this.AzureArc.Visibility = System.Windows.Visibility.Visible;
                        this.ArcRotation5.Begin();
                        break;
                    }
                default:
                    {
                        //throw exception
                        break;
                    }
            }
        }
    }
}
